package com.bupt.film.client;


import com.bupt.config.FeignClientsConfigurationCustom;
import com.bupt.config.FeignErrorDecoder;
import com.bupt.film.entity.Film;
import com.bupt.film.entity.Hall;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;
import java.util.Map;

@FeignClient(value = "film-info-service", configuration = {FeignErrorDecoder.class, FeignClientsConfigurationCustom.class})
public interface FilmInfoClient {

    @RequestMapping("/film-info/getHallsInfoList")
    List<Hall> getHallsInfoList();

    @RequestMapping("/film-info/getHallsInfo")
    String getHallsInfo();

    @RequestMapping("/film-info/getOneHallInfo")
    Hall getOneHallInfo(@RequestParam String hallId);

    @RequestMapping("/film-info/getFilmsInfo")
    List<Film> getFilmsInfo();

    @RequestMapping("/film-info/getOneFilmInfo")
    Film getOneFilmInfo(@RequestParam String filmId);

    @RequestMapping("/film-info/getFilmsWithinTimeRange")
    List<Film> getFilmsWithinTimeRange(@RequestParam String hallId, @RequestParam Date startTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime);

    /**
     * 根据放映厅编号，影片名称，放映日期查询场次，价格，剩余票数
     */
    @RequestMapping("/film-info/getFilmShowDetail")
    Map<String, Object> getFilmShowDetail(@RequestParam String hallId, @RequestParam String filmId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date showDate);

}
